<form class="tableform" id="form-orderpay" method='post' action='index.php?app=ome&ctl=admin_finance&act=do_payorder&p[0]=<{$order.order_id}>&finder_id=<{$env.get.finder_id}>'>
<input type='hidden' name='order_id' id='order_id' value='<{$order.order_id}>'>
<input type='hidden' name='shop_id' id='shop_id' value='<{$shop_id}>'>
<input type='hidden' name='inContent' value='true'>
<input type='hidden' name='api_fail_flag' id='api_fail_flag' value='<{$api_fail_flag}>' />
<input type='hidden' name='api_payment_request' id='api_payment_request' value='false' />

<div class="division">
<table width="100%">
  <tbody>
  <tr>
    <th><{t}>订单号：<{/t}></th>
    <td><{$order.order_bn}> 【<{if $order.pay_status == 0}><{t}>未支付<{/t}><{elseif $order.pay_status == 1}><{t}>已支付<{/t}><{elseif $order.pay_status == 2}><{t}>处理中<{/t}><{elseif $order.pay_status == 3}><{t}>部分付款<{/t}><{elseif $order.pay_status == 4}><{t}>部分退款<{/t}><{elseif $order.pay_status == 5}><{t}>已退款<{/t}><{/if}>】</td>
    <th><{t}>下单日期：<{/t}></th>
    <td><{$order.createtime|cdate}></td>
      </tr>
  <tr>
    <th><{t}>订单总金额：<{/t}></th>
    <td><{$order['total_amount']}></td>
    <th><{t}>已支付金额：<{/t}></th>
    <td><{$order.payed}></td>
    </tr>
  <tr>
    <th><{t}>收款银行：<{/t}></th>
    <td colspan="3"><{input type='text' id='payBank' name='bank' value='' width="100"}> <{input id="selectAccount" type="select" name='select_account' options=$pay_account value=''}></td>
    </tr>
    <tr>
      <th><{t}>收款帐号：<{/t}></th>
      <td colspan="3"><{input type='text' id='payAccount' name='account' value='' width="200"}></td>
    </tr>
    <tr>
      <th><{t}>第三方交易号：<{/t}></th>
      <td colspan="3"><{input type='text' id='trade_no' name='trade_no' value='' width="200" }></td>
    </tr>
    <tr>
      <th><{t}>收款金额：<{/t}></th>
      <td colspan="3"><{input type='number&&required' name='money' value=$pay_money  width="100" }></td>
<!--      <th><{t}>收款人：<{/t}></th>
      <td><{$op_name}></td> -->
    </tr>
  <tr>
    <th><{t}>付款类型：<{/t}></th>
    <td colspan="3"><{input type="radio" name="pay_type" options=$typeList value=$pay_type vtype='requiredradio'}></td>
  </tr>
     <tr>
    <th><{t}>支付方式：<{/t}></th>
    <td>
    <{if $payment}>
    <{if $node_id}>
    <select id='payment' name='payment'>
        <{if $payment_id}>
          <{foreach from=$order_paymentcfg key=key item=item}>
            <option value="<{$item.id}>"><{$item.custom_name}></option>
          <{/foreach}>
        <{/if}>
    </select>
    <{else}>
        <{input type="select" id="payment" name='payment' rows=$payment valueColumn="id" labelColumn="custom_name" value=$payment_id}>
    <{/if}>
    <{else}>
    <select id='payment' name='payment'>
    </select>
    <em class="red">请先添加或同步前端店铺支付方式</em>
    <{/if}>
    </td>
    <th><{t}>客户支付货币：<{/t}></th>
    <td><{$order.cur_name}> (<{$order.final_amount|cur:$order.currency:false:false}>)</td>
    </tr>
    <tr>
    <th><{t}>是否开票：<{/t}></th>
    <td><{if $order.is_tax == 'true'}><{t}>是<{/t}><{else}><{t}>否<{/t}><{/if}></td>
    <th><{t}>税金：<{/t}></th>
    <td><{$order.cost_tax|cur}></td>
   </tr>
  <tr>
    <th><{t}>发票抬头：<{/t}></th>
    <td><{$order.tax_title}></td>
      <th><{t}>支付帐号：<{/t}></th>
      <td><{input type='text' name='pay_account' width="100" value=$member.name }></td>
     </tr>
   <tr>
   <{if $order.is_tax == 'true'}>
   <th><{t}>发票号：<{/t}></th><td><{input type='text' name='tax_no'  value='' }></td>
   <{/if}>
   </tr>
   <tr>
     <th><{t}>支付单备注：<{/t}></th>
     <td colspan="3"><textarea name="memo"  cols="80" rows="5" value='<{$detail.memo}>'></textarea></td>
   </tr>
  </tbody>
</table>
<div class="division" align="center">
    <{button type="button" id="btn-submit" label="提交" class="btn-primary"}>
</div>

</div>

</form>

<script>
(function(){

	$$('input[name^=pay_type]').addEvent('click', function(){
		var order_id = $('order_id').value, shop_id = $('shop_id').value, pay_type = this.value;
		W.page('index.php?app=ome&ctl=admin_finance&act=payment_by_pay_type&p[0]='+order_id+'&p[1]='+shop_id+'&p[2]='+pay_type,{update:$('payment')});
	});

	$('btn-submit').addEvent('click', function(){
		var api_fail_flag = 'false',api_payment_request;
		api_fail_flag = $('api_fail_flag').value;
		if (api_fail_flag == 'true'){
			if (confirm("该订单上次同步支付失败，此次支付是否仍然发送同步请求?")){
				api_payment_request = 'true';
			}else{
				api_payment_request = 'false';
			}
			$('api_payment_request').set('value', api_payment_request);
		}else{
			<{if $order.pay_status == 8}>
				if (confirm("上次支付单同步请求超时，确定不同步直接支付吗?")){
					api_payment_request = 'false';
					$('api_payment_request').set('value', api_payment_request);
		        }else{
		            return false;
		        }
			<{/if}>
		}
	    $('form-orderpay').fireEvent('submit',{stop:function(){}});
	});

	var finder = finderGroup['<{$env.get.finder_id}>'];
	$('form-orderpay').store('target',{
	    onRequest:function(){
	       $('btn-submit').set('disabled', 'true');
	    },
	    onComplete:function(jsontext){
	       var json = Json.evaluate(jsontext);
	       if (typeof(json.error) != 'undefined'){
	    	   $('btn-submit').set('disabled', '');
	       }else{
	    	   $('btn-submit').set('disabled', 'true');
	           finderGroup['<{$env.get.finder_id}>'].refresh.delay(400,finderGroup['<{$env.get.finder_id}>']);
	           $('btn-submit').getParent('.dialog').retrieve('instance').close();
	       }
	    }
	});

	$('selectAccount').addEvent('change', function(e){
	  e=new Event(e);
	  var ipt=e.target;
	  var str = ipt.value;
	  var aItems = str.split('-');
	  $('payBank').value = aItems[0];
	  $('payAccount').value = aItems[1];
	});

})();
</script>